The present invention relates to displaying graphical image on a computer system and more particularly to a method and system for performing antialiasing using a single blending unit, which reduces the size of the system, without requiring additional time in most cases.
A conventional computer graphics system can display graphical images of objects on a display. The display includes a plurality of display elements, known as pixels, typically arranged in a grid. In order to display objects, the conventional computer graphics system typically breaks each object into a plurality of polygons. A conventional system then renders the polygons in a particular order. For a three-dimensional scene, the opaque polygons are generally rendered from front to back as measured from the viewing plane of the display. Translucent polygons are desired to be rendered from back to front. Similarly, a two-dimensional scene can be displayed. For a two-dimensional scene, polygons are rendered based on a layer order, rather than on a depth value. Shallower layers occlude deeper layers.
Each of the polygons includes edges. When rendering an image, the conventional system often renders diagonal lines or polygon edges that are not perfectly horizontal or vertical. Because each pixel has finite physical dimensions, edges which are not horizontal or vertical may appear jagged. For example, consider each pixel to be a square. A diagonal line or edge rendered using the square pixels will appear jagged, similar to a staircase. This effect is known as aliasing.
In order to reduce aliasing, conventional systems perform antialiasing. Antialiasing helps reduce the effect that the physical dimension of the pixels has on the appearance of objects being displayed. Diagonal lines and edges appear smoother.
Several conventional mechanisms are used to perform antialiasing. Many of the conventional techniques also evaluate and blend data on the subpixel level. Each mechanism also has its drawbacks. For example, one conventional mechanism for antialiasing is conventional supersampling. Conventional supersampling is performed for a portion of the display, called a tile, or the entire display at a time. Each pixel in the tile or display is considered to be an Mxc3x97N matrix subpixels. Data for each polygon in the tile is evaluated at each subpixel. Thus, the depth value, color, texture, and other data for the polygon can differ in and is evaluated at each subpixel. Data for the subpixels in each pixel in the tile are combined to provide the data for each pixel in the tile. Because supersampling evaluates and combines depth values for subpixels, supersampling can help smooth out the staircasing effect on implicit edges. However, the system requires sufficient memory to retain data for the Mxc3x97N subpixels in each pixel in a tile to perform supersampling. Therefore, a large amount of memory is required. This increases the size of the system. It must also be ensured that there are no artifacts at the seams between tiles. This slows processing. Furthermore, much more data is processed for each pixel in the display, regardless of any uniformity of the subpixels within a pixel. Supersampling is thus computation intensive and relatively slow.
Some conventional systems address some of the problems in supersampling by performing adaptive supersampling. Adaptive supersampling first identifies areas where supersampling may be desired, such as near edges. Once this area is identified, supersampling is performed for a tile in including this area. In other areas, supersampling is not performed. For example, a conventional system could mark the edges of each polygon, indicating that the edges are the exterior of the polygon and thus form the silhouette of the polygon. This silhouette is antialiased. Although adaptive supersampling improves processing speed by reducing the areas subjected to supersampling, a large amount of memory is still required. Furthermore, the identification of areas to be supersampled can be computation intensive. For example, the determination of the silhouette of a polygon, discussed above, requires a relatively expensive computation. Thus, the system may still be relatively large or slow.
Another conventional mechanism for antialiasing uses an accumulation buffer (xe2x80x9cA-bufferxe2x80x9d) and is known as an A-buffer technique. Data for each pixel in each polygon is processed. During processing, a mask is provided for each pixel in each polygon. The mask indicates the portion of the pixel covered by the polygon. The mask can thus be viewed as indicating the subpixels each polygon covers. A linked list of the polygon masks is then provided for each pixel. The linked list typically holds a mask, a color value, and other data relating to each polygon""s potential contribution to the display of the pixel. After the entire scene has been stored in the A-buffer, the linked list is then traversed in order to accumulate and render data from the polygons associated with each pixel. Aliasing is thereby reduced. However, two passes are made through the data in order to render objects to the display. The first pass is to provide the masks for each polygon and to associate the polygons with particular pixels. The second pass utilizes the data stored for each pixel to determine how data for each pixel is to be displayed. Thus, this mechanism is time consuming. The linked list must also be managed by the computer graphics system, making the A-buffer technique more difficult to implement. Typically both an A-buffer and a frame buffer are used in rendering the scene. Therefore, the A-buffer technique also requires additional memory.
Yet another conventional method for antialiasing could use a weighting factor. The weighting factor indicates the percentage of a pixel which a polygon occupies. For example, if a polygon occupies an entire pixel, the weighting factor may be one. The weighting factor for pixels at the edges of the polygon may thus be less than one. This weighting factor would then be taken into account when the data for different polygons intersecting a pixel are blended.
The above conventional antialiasing techniques have an additional drawback. In order to maintain processing speed, the above conventional methods may use multiple blending units or a more complex blending unit. A blending unit performs the mathematical operation that blends a stored value, such as color for a subpixel, with a color for a fragment. In the conventional antialiasing method that uses weighting, the blending unit may be more complex in order to account for the weight. Similarly, supersampling, adaptive supersampling, and the A-buffer technique may use multiple blending units to maintain processing speed. This is because supersampling, adaptive supersampling, and the A-buffer technique evaluate and combine data at the subpixel level. Blends are thus performed for each subpixel in a pixel to ensure that each subpixel contributes the correct color and other information to the pixel. In order to maintain processing speed when subpixels are used, the blends for each subpixel are typically performed in parallel. A blending unit for each subpixel is used to perform these blends in parallel.
Although a blending unit can be used for each subpixel, as the number of subpixels used increases, the number of blending units increases dramatically. For example, for a 2xc3x972 array of subpixels, four blending units are required to perform all operations in parallel. For a 4xc3x974 array of subpixels, sixteen blending units are required to perform all operations in parallel. Providing such a large number of blending units consumes a great deal of space and is quite costly, both of which are undesirable.
Accordingly, what is needed is a system and method for reducing the number of blending units used. It would also be desirable if the system and method did not sacrifice performance. The present invention addresses such a need.
The present invention provides a method and system for antialiasing of a graphical image on a display. The graphical image is generated from data describing at least one object. The display includes a plurality of pixels. The at least one object includes a plurality of fragments. A portion of the plurality of fragments intersects a pixel of the plurality of pixels. Each of the plurality of fragments includes an indication of a portion of a corresponding pixel that is intersected. The system and method comprise providing at least one active region for the pixel. The at least one active region intersects a first portion of the pixel. The method and system also comprise providing at least one new region. A first portion of the at least one new region indicates where in the pixel the at least one active region and the fragment intersect. A second portion of the at least one new region indicates where in the pixel the at least one active region and the fragment do not intersect. The method and system further comprise blending a portion of the fragment in a second portion of the pixel corresponding to the first portion of the at least one new region.
According to the system and method disclosed herein, the present invention provides antialiasing using fewer blending units, thereby decreasing overall system size, generally without adversely impacting performance.